﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace T7task1
{
    public partial class Form2 : Form
    {
        DataTable bt = new DataTable();
        public Form2()
        {
            InitializeComponent();
        }

        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form2_Load(object sender, EventArgs e)
        {
            string sql = "select * from Li";
            bt = DBHelper.SelectByAdapter(sql);
            dataGridView1.DataSource = bt;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataView dv = new DataView(bt);
            dv.RowFilter = string.Format("GameName like '%{0}%' ", textBox1.Text);
            dataGridView1.DataSource = dv;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DataView dv = new DataView(bt);
            dv.Sort = "Style desc";
            dataGridView1.DataSource = dv;
        }
    }
}
